package com.booksys.examination.config;

import io.swagger.annotations.ApiOperation;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.servlet.config.annotation.EnableWebMvc;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.service.Contact;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * @author Administrator
 * @date 2019-08-19 9:30
 */
@Configuration
@EnableSwagger2
@EnableWebMvc
@ComponentScan(basePackages = "com.booksys.examination.controller")
public class MySwaggerConfig {
    @Bean
    public Docket myDocket(){
        return new Docket(DocumentationType.SWAGGER_2).select().apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class)).build();
    }

   /* private ApiInfo apiInfo() {
        return new ApiInfoBuilder()
                .title("新闻发布系统开放RESTful APIs接口文档")
                .contact(new Contact("刘垛生", "http://www.hfjava.cn", "290982492@qq.com"))
                .version("1.0")
                .description("新闻发布系统开放RESTful APIs接口文档")
                .termsOfServiceUrl("http://localhost:8080/doc.html")
                .build();
    }*/
}
